local Lua__nianlaoxb = fk.CreateSkill({
  name = "Lua__nianlaoxb",
  tags = {Skill.Compulsory}
})

Fk:loadTranslationTable{
  ["Lua__nianlaoxb"] = "年老血薄",
  ["$Lua__nianlaoxb1"] = "最近力量有点衰退了这可不行啊。",
  [":Lua__nianlaoxb"] = "你受到伤害时，改为失去等量的体力上限。",
}

Lua__nianlaoxb:addEffect(fk.DamageInflicted, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(Lua__nianlaoxb.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:notifySkillInvoked(player, Lua__nianlaoxb.name, "defensive")
    
    local damage = data.damage
    
    -- 失去等量的体力上限
    room:changeMaxHp(player, -damage)
    
    -- 取消伤害
    data:preventDamage()
  end,
})

return Lua__nianlaoxb 